<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {

		$('#pid').combotree({
			url : '/accountFeature/tree',
			parentField : 'pid',
			lines : true,
			panelHeight : 'auto',
			value : '0',
			onLoadSuccess : function() {
				parent.$.messager.progress('close');
				$('#pid').combotree("setText","选择上级功能");
				
			}
		});
		
		
		$('#form').form({
			url : '/accountFeature/add',
			onSubmit : function() {
				$("#parId").val("0");
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
					
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}
			}
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>功能名称</th>
					<td><input name="name" type="text" placeholder="请输入功能名称" class="easyui-validatebox span2" data-options="required:true" value=""></td>
				</tr>
				<tr>
					<th>功能描述</th>
					<td><input name="remark" type="text" placeholder="请输入描述" class="easyui-validatebox span2" value=""></td>
				</tr>
				<tr>
					<th>上级资源</th>
					<td><select id="pid" name="parentId" style="width: 140px; height: 29px;"><option value="0" selected="selected">选择上级功能</option></select><img src="/images/extjs_icons/cut_red.png" onclick="$('#pid').combotree('clear');" /></td>
				</tr>
			</table>
		</form>
	</div>
</div>